﻿namespace MefContrib.Models.Provider.Tests
{
    using System.Collections.Generic;
    using NUnit.Framework;
    using System.Collections.ObjectModel;

    [TestFixture]
    public class PartDescriptionTests
    {
        [Test]
        public void ConstructorShouldAssignValuesToProperties()
        {
            Collection<ExportDescription> exports =
                new Collection<ExportDescription>();

            Collection<ImportDescription> imports =
                new Collection<ImportDescription>();

            PartDescription description =
                new PartDescription
                {
                    Imports = imports,
                    Exports = exports,
                    TypeName = "dummy value"
                };

            Assert.AreSame(description.Exports, exports);
            Assert.AreSame(description.Imports, imports);
            Assert.AreEqual(description.TypeName, "dummy value");
        }

        [Test]
        public void ExportsShouldStoreSetValue()
        {
            Collection<ExportDescription> exports =
                new Collection<ExportDescription>();

            PartDescription description =
                new PartDescription { Exports = exports };

            Assert.AreSame(description.Exports, exports);
        }

        [Test]
        public void ImportsShouldStoreSetValue()
        {
            Collection<ImportDescription> imports =
                new Collection<ImportDescription>();

            PartDescription description =
                new PartDescription { Imports = imports };

            Assert.AreSame(description.Imports, imports);
        }

        [Test]
        public void TypeNameShouldStoreSetValue()
        {
            PartDescription description =
                new PartDescription { TypeName = "dummy value" };

            Assert.AreEqual(description.TypeName, "dummy value");
        }
    }
}